#ifndef _MACHINE_H_
#define _MACHINE_H_
#include "commsvr.h"
#include "websvr.h"
#include "business.h"
#include <string>

struct macopt{
	char script[256];
	char commsvrip[32];
	unsigned short commsvrport;
	char webpath[256];
	char websvrip[32];
	unsigned short websvrport;
	char option[256];
};

class cmachine : public ccommsvr, public cwebsvr, public cbusiness{
public:
	bool poweron(macopt& opt);
	bool poweroff();
private:
	std::map<std::string, lua_State*> m_States; 

public:
	virtual int onResponse(sockaddr& addr, char* data, size_t len);
	virtual void execute(const char* file, const char* func, const char* args,std::string & rsp);
	virtual void execute(char* addr, char* data, size_t size);
	virtual void execute(const char* cmd);
};
#endif


